<?php
    session_start();
    require_once('../ns_html.class.php');
    
    if (isset($_SESSION['username']))
    {
        $thisUser = $html->nsDatabase->UserByUsername($_SESSION['username']);
    }
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="ns_style.css" />
<link rel="shortcut icon" href="favicon.ico" />
<script src="ns_js.js" type="text/javascript"></script>

<title>Nordic-Sauna</title>
</head>
<body>

<div class="topGradient">
<img src="img/gradient.png" width="100%" height="90%" alt="logo" />
</div>

<div class="top">
<!--<img src="img/logo.png" width="10%" height="10%" alt="logo" align="top"/>-->
<strong>Nordic-Sauna</strong>
</div>

<?php
    echo $html->getOpenLeft();
    
    if(!isset($_SESSION['username']))
    {
?>
        <form name="loginForm" action="login.php" method="post">
        <table border="0" cellpadding="2" cellspacing="2" width="96%">
        <tr align="right"><td><strong>Username</strong></td></tr>
        <tr align="right"><td><input type="text" name="username" value="" size="15" /></td></tr>
        <tr align="right"><td><strong>Password</strong></td></tr>
        <tr align="right"><td><input type="password" name="password" value="" size="15" /></td></tr>
        <tr align="right"><td><input type="submit" name="loginSubmit" value="Login" /></td></tr>
        </table>
        </form>
        <br /><br />

<?php
    }
    else if (isset($_SESSION['username']))
    {
?>
        <table border="0" cellpadding="2" cellspacing="2" width="96%">
        <tr align="right"><td><?php echo "<strong>Hi ".$thisUser->Username()."!</a>"; ?></td></tr>        
        <tr align="right"><td><img src="<?php echo $thisUser->AvatarImage();  ?>" height="60px" width="60px"></img></td></tr>
        <tr class="highlightRows" align="right"><td><a href="my_profile.php">My Profile</a></td></tr>
        <tr class="highlightRows" align="right"><td>My Software</td></tr>
        <tr class="highlightRows" align="right"><td><a href="logout.php">Logout</a></td></tr>
        </table>

<?php	
    }
    
    echo $html->getCloseLeft();
    echo $html->getOpenTop();
?>

<table width="100%" border="0" cellpadding="1" cellspacing="1" align="center">
<tr>
<td class="highlightCell" align="center"><a href="index.php"><strong>Home</strong></a></td>
<td class="highlightCell" align="center"><a href="browse.php"><strong>Browse</strong></a></td>
<td class="highlightCell" align="center"><a href="register.php"><strong>Register</strong></a></td>
<td class="highlightCell" align="center"><strong>Support</strong></td>
<td class="highlightCell" align="center"><strong>Contact</strong></td>
</tr>
</table>

<?php
    echo $html->getCloseTop();
    echo $html->getOpenBody();
?>